
/*
 * @Description: 
 * @Author: rendc
 * @Date: 2024-10-09 11:06:29
 * @LastEditors: rendc
 * @LastEditTime: 2024-10-09 11:12:37
 */
import java.util.ArrayList;
import java.util.List;

/**
 * Test3-1
 */
public class Test3_1 {
  public static void main(String[] args) {
    // 定义一个集合
    List<String> list = new ArrayList<String>();
    list.add("hello");
    list.add("world");
    list.add("hello");
    list.add("java");
    list.add("hello");
    System.out.println(list);
    List<String> newList = new ArrayList<String>();
    for (String str : list) {
      if (!newList.contains(str)) {
        newList.add(str);
      }
    }
    System.out.println(newList);
  }
}